package com.csailing4cloud.csailing.common.feign.hystrix;

import com.csailing4cloud.csailing.common.core.constants.CommonConstants;
import com.csailing4cloud.csailing.common.core.util.CsResponse;
import lombok.Getter;

/**
 * @author
 * feign 自定义异常
 */
public class CsailingFeignException extends RuntimeException{
    @Getter
    private final CsResponse result;

    public CsailingFeignException(CsResponse result) {
        super(result.getMessage());
        this.result = result;
    }

    public CsailingFeignException(String message) {
        super(message);
        this.result = CsResponse.builder()
                .code(CommonConstants.FAIL)
                .message(message).build();
    }

    /**
     * 提高性能
     *
     * @return {Throwable}
     */
    @Override
    public Throwable fillInStackTrace() {
        return this;
    }
}
